package com.alibaba.service.impl;

import com.alibaba.domain.User;
import com.alibaba.mapper.UserMapper;
import com.alibaba.service.UserService;
import com.alibaba.utils.MapperUtils;

import java.util.List;

public class UserServiceImpl implements UserService {
    private UserMapper mapper = (UserMapper) MapperUtils.getMapper(UserMapper.class);

    //查询所有
    public List<User> findAll() {
        return mapper.findAll() ;
    }

    //添加用户
    public int save(User user) {
        return mapper.save(user);
    }

    //删除用户
    public void deleteByIds(Integer[] ids) {
       if (ids.length>0 && ids != null){
           mapper.deleteByIds(ids);
       }
    }

    //根据id查询用户
    public User findById(String uid) {
        return mapper.findById(uid);
    }

    //修改用户
    public void update(User user) {
        mapper.update(user);
    }
}
